#include <limits.h>
#include <stdlib.h> /* srand, rand */
#include <time.h>   /* time */

#include <algorithm>
#include <iostream>
#include <vector>

#include "gtest/gtest.h"

using std::sort;
using std::vector;

namespace Solution
{
vector<int>& sortArray( vector<int>& nums );
}
namespace
{

TEST( quickSort, randomElements )
{
    srand( time( NULL ) );

    vector<int> nums{};
    vector<int> nums_comparison{};

    for ( int i = 0; i < rand() % 50 + 3; ++i ) {
        nums.push_back( rand() % 100 + 1 );
    }

    for ( auto i : nums ) {
        nums_comparison.push_back( i );
    }

    Solution::sortArray( nums );
    sort( nums_comparison.begin(), nums_comparison.end() );

    for ( auto i = 0U; i < nums.size(); ++i ) {
        ASSERT_EQ( nums_comparison[i], nums[i] );
    }
}
}  // namespace
